package com.Index;


import com.buttlever.ConnectWindowView;
import com.singlever.SingleGoBangView;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Button;

/**
 * @author acoffee
 * @create 2021-08-31 20:20
 */
public class IndexButtonService {

    //点击单机版按钮绑定单击事件
    public void singleBtnAction(Button singleBtn, GameIndexView gameIndexView){
        singleBtn.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                //当我们选择单机版之后，我们就去创建单机版的对象
                SingleGoBangView singleGoBangView = new SingleGoBangView();
                gameIndexView.close();
                singleGoBangView.show();
            }
        });
    }

    public void buttleBtnAction(Button buttleBtn, GameIndexView gameIndexView){
        buttleBtn.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                ConnectWindowView connectWindowView = new ConnectWindowView();
                gameIndexView.close();
                connectWindowView.show();
            }
        });
    }
}
